package com.zxy.config.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.Date;

@Data
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class ResultData {

    private Integer code;
    private String msg;
    private Object data;
    private Date date;
    public ResultData resultData(Integer code,String msg,Object data){
        return new ResultData(code,msg,data,new Date());
    }

    public ResultData success(Object data){
        return resultData(200,"执行成功",data);
    }
    public ResultData fail(Integer code,String msg){
        return resultData(code,msg,null);
    }
}
